<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <title>10-01颜色相关样式</title>
    <link rel="stylesheet" href="../common.css">
    <script src="../jquery-2.2.0.js"></script>
    <script src="../main.js"></script>
    <style>

        body{
            margin: 0;
            background: url("../08layout/tengWangGe.jpg") fixed;
            background-size: cover;
        }
        h1{
            margin-top: 0;
            padding-top: 1.5em;
        }
        div{
            height: 100px;
            text-align: center;
            font-size: 2rem;
            font-weight: bold;
            margin: 5px;
        }
        section{
            width: 80%;
            margin:auto;
            outline:1px dashed gray;
        }
        #rgba div:nth-of-type(1){
            background-color: rgb(255,255,0);
        }
        #rgba div:nth-of-type(2){
            background-color: rgba(255,255,0,0.8);
        }
        #rgba div:nth-of-type(3){
            background-color: rgba(255,255,0,0.3);
        }

        /*h为色调，s为饱和度，l为亮度*/
        #hsla div:nth-of-type(1){
            background-color: hsl(90,100%,50%);
        }
        #hsla div:nth-of-type(2){
            background-color: hsla(90,100%,50%,0.7);
        }
        #hsla div:nth-of-type(3){
            background-color: hsla(90,100%,50%,0.3);
        }

        #opacity div{
            font-family: 黑体;
            display: table-cell;
            vertical-align: middle;
            border:1px solid orange;
        }
        #opacity div:nth-of-type(1){
            color: rgb(255,255,255);
            background-color: rgb(0,0,255);
        }
        #opacity div:nth-of-type(2){
            color: rgb(255,255,255);
            background-color: rgba(0,0,255,0.5);
        }
        #opacity div:nth-of-type(3){
            color: rgba(255,255,255,0.5);
            background-color: rgba(0,0,255,1);
        }
        #opacity div:nth-of-type(4){
            color: rgba(255,255,255,0.5);
            background-color: rgba(0,0,255,0.5);
        }
        #opacity div:nth-of-type(5){
            color: rgba(255,255,255,1);
            background-color: rgba(0,0,255,1);
            opacity:0.5;
        }

        #transparent div{
            font-family: 黑体;
            display: table-cell;
            vertical-align: middle;
            border:5px solid orange;
            background-color: pink;
            color: red;
        }
        #transparent div:nth-of-type(2){
            border-color: transparent;
        }
        #transparent div:nth-of-type(3){
            background-color: transparent;
        }
        #transparent div:nth-of-type(4){
            color: transparent;
        }
    </style>
</head>
<body>
<h1>10-01颜色相关样式</h1>
<h2 class="problem">代码显示在文本中</h2>
<h3>带透明度的rgba颜色格式</h3>
<section id="rgba">
    <div>background-color: rgb(255,255,0);</div>
    <div>background-color: rgba(255,255,0,0.8);</div>
    <div>background-color: rgba(255,255,0,0.3);</div>
</section>

<hr>
<h3>带透明度的hsla颜色格式</h3>
<p style="background-color: #cccccc;padding: 5px;"><strong> &nbsp;h为色调，s为饱和度，l为亮度</strong></p>
<section id="hsla">
    <div>background-color: hsl(90,100%,50%);</div>
    <div>background-color: hsla(90,100%,50%,0.7);</div>
    <div>background-color: hsla(90,100%,50%,0.3);</div>

</section>

<hr>
<h3>颜色的半透明和元素半透明的对比</h3>
<section id="opacity">
    <div>背景和文字都不透明</div>
    <div>背景半透明，文字不透明</div>
    <div>背景不透明，文字半透明</div>
    <div>背景和文字都半透明</div>
    <div>背景和文字都不透明，但整个元素半透明</div>
</section>

<hr>
<h3>transparent透明度测试</h3>
<section id="transparent">
    <div>背景、边框和文字都不透明</div>
    <div>边框透明</div>
    <div>背景透明</div>
    <div>文字透明</div>
    <div>上一个div的文字透明了看不到，但能选中</div>
</section>
<br><br><br><br><br><br>
</body>
</html>